/* eslint-disable class-methods-use-this */
import _axios, { get, put, _delete } from '@/lin/plugin/axios'
import Config from '../config'
// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class position {
    // constructor() {}

    // 类中的方法可以代表一个用户行为
    async createposition(data) {
        return _axios({
            method: 'post',
            url: 'v1/position',
            data,
        })
    }

    // 在这里通过 async await 语法糖让代码同步执行
    // 1. await 一定要搭配 async 来使用
    // 2. await 后面跟的是一个 Promise 对象
    
 

    async editposition(id, info) {
        const res = await put(`v1/position/${id}`, info)
        return res
    }

    async deleteposition(id) {
        const res = await _delete(`v1/position/${id}`)
        return res
    }

    async getposition() {
        return [{
            name: "恒生电子前端",
            level:"高级",
            leader:'冯陈楚卫',
            minSalary:"10",
            maxSalary:"15",
            switchVal: true,
            background:"不限",
            date: '智联招聘',
            occupational:1,
            address:"杭州",
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            education:"本科学信",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '112',
        }, {
            background:"1年",
            name: "恒生电子前端",
            level:"高级",
            leader:'蒋沈韩杨',
            date: '智联招聘',
            minSalary:"10",
            maxSalary:"15",
            occupational:2,
            switchVal: true,
            address:"杭州",
            education:"本科学信",
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '142',
        }, {
            background:"2年",
            level:"初级",
            leader:'赵钱孙李',
            name: "恒生电子前端",
            switchVal: false,
            occupational:4,
            date: '智联招聘',
            minSalary:"4",
            maxSalary:"5",
            address:"杭州",
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            education:"本科学信",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '125',
        }, {
            switchVal: false,
            level:"初级",
            name: "恒生电子前端",
            leader:'赵钱孙李',
            minSalary:"7",
            maxSalary:"20",
            date: '智联招聘',
            occupational:3,
            hr: "智联招聘",
            background:"不限",
            id: '266',
            address:"杭州",
            education:"大专学信",
            address:"杭州",
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            occupational:1,
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            level:"中级",
            education:"本科不限",
            minSalary:"9",
            maxSalary:"23",
            address:"杭州",
            leader:'冯陈楚卫',
            date: '智联招聘',
            switchVal: false,
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            occupational:4,
            state: "王",
            occupational:1,
            tel: "4541811",
            background:"不限",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            address:"杭州",
            level:"初级",
            date: '智联招聘',
            switchVal: true,
            leader:'冯陈楚卫',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            occupational:1,
            state: "王",
            tel: "4541811",
            switchVal: true,
            remark: "未来可期",
            background:"不限",
            occupational:4,
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            leader:'冯陈楚卫',
            level:"初级",
            address:"杭州",
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            switchVal: true,
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            background:"不限",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            switchVal: true,
            level:"初级",
            leader:'冯陈楚卫',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            background:"不限",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            address:"杭州",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            switchVal: false,
            hr: "智联招聘",
            id: '266',
            position: '运维',
            address:"杭州",
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            id: '266',
            address:"杭州",
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            address:"杭州",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        }, {
            name: "恒生电子前端",
            date: '智联招聘',
            hr: "智联招聘",
            id: '266',
            position: '运维',
            salary: "22",
            mail: "442121@qq.com",
            state: "王",
            tel: "4541811",
            remark: "未来可期",
            num1: '2',
            num2: '5',
            num3: '12',
        },]
        return _axios({
            method: 'get',
            url: 'v1/position',
            handleError: true,
        })
    }
    //组织管理服务
    async organizationList(params){
        // const res = await get(`/dictitem/list`, data)
        // return res
        return _axios({
            method:"post",
            url: '/organization/list',
            params,
        })
    }
    //职业查询
    async positionQuery(params){
        // const res = await get(`/dictitem/list`, data)
        // return res
        return _axios({
            method:"post",
            url: Config.baseURL2+'/position/query',
            params,
        })
    }
    //职业新增
    async positionAdd(params){
        return _axios({
            method:"post",
            url: Config.baseURL2+'/position/add',
            params,
        })
    }
}

export default new position()
